home *** CD-ROM | disk | FTP | other *** search
/ ...taking it to the Macs! / ...taking it to the Macs!.iso / Extras / ActiveX Mac SDK / ActiveX SDK / Container Common / cpropbag.hpp < prev    next >
Encoding:
C/C++ Source or Header  |  1997-01-02  |  2.1 KB  |  88 lines  |  [TEXT/dosa]

  1. #ifndef __CPROPBAG_HPP__
  2. #define __CPROPBAG_HPP__
  3.  
  4. #include <olectl.h>
  5.  
  6. #ifdef __cplusplus    // class definition should be invisible to C sources...
  7.  
  8.  
  9. typedef struct tagProperty
  10. {
  11. //    BSTR     pwcName;     // BUGBUG we'll need to move this into unicode 
  12.                             // at some point (after PDC)
  13.     char    *pszName;
  14.     VARIANT *pvarValue;
  15. }PROPERTY;
  16.  
  17. typedef struct tagPropertyList
  18. {
  19.     PROPERTY *pProperty;
  20.     VOID     *pNext;
  21.     VOID     *pPrev;
  22. }PROPERTYLIST;
  23.  
  24. class CPropertyBag : public IPropertyBag
  25. {
  26. // public interface
  27. public:
  28.     // CPropertyBag methods
  29.     CPropertyBag();
  30.     virtual ~CPropertyBag();
  31.     void     AddParam(const char *name, const char *value );
  32.     void     setExtents(ULONG, ULONG);
  33.  
  34.     // IUnknown 
  35.     STDMETHODIMP    QueryInterface(REFIID, LPVOID *);
  36.     STDMETHODIMP_(ULONG) AddRef(void);
  37.     STDMETHODIMP_(ULONG) Release(void);
  38.  
  39.     // IPropertyBag methods
  40.     
  41.     // Asks the property bag to read the property named with pszPropName 
  42.     // into the caller-initialized VARIANT in pVar.  
  43.     //
  44.     STDMETHODIMP_(HRESULT) Read(LPCOLESTR, VARIANT *, IErrorLog *);
  45.  
  46.     // Asks the property bag to save the property named with 
  47.     // pszPropName using the type and value in the 
  48.     // caller-initialized VARIANT in pVar.
  49.     //
  50.     STDMETHODIMP_(HRESULT) Write(LPCOLESTR, VARIANT *);
  51.  
  52.  
  53. // internal helpers
  54. private:    
  55.  
  56.     // The internal non Unicode version of Write
  57.     HRESULT lpstrWrite(const char *, VARIANT *);
  58.     // The internal non Unicode version of Read
  59.     HRESULT lpstrRead(const char *, VARIANT *, IErrorLog *pErrorLog);
  60.     
  61.     BOOL addToPropertyList(PROPERTY *pProperty);
  62.     BOOL deletePropertyList();
  63.     BOOL find(const char *, PROPERTY * *ppProperty);
  64.     HRESULT GetPropertyBagContents( VARIANT *pVar, IErrorLog *pErrorLog);
  65.  
  66.  
  67. // class data
  68.     DWORD            m_cRef;            // reference count of object
  69.     PROPERTYLIST   *m_pProperties;
  70.     PROPERTYLIST   *m_pPropertiesHead;
  71.     PROPERTYLIST   *m_pPropertiesTail;
  72.     UINT            m_cProperties;
  73.     char far *     *m_pbContents;
  74.  
  75. };
  76.  
  77.  
  78.  
  79. typedef CPropertyBag * LPCPropertyBag;
  80. DECLARE_STANDARD_TYPES(CPropertyBag);
  81.  
  82. #endif  //__cplusplus
  83.  
  84.  
  85.  
  86.  
  87. #endif    // __CPROPBAG_HPP__
  88.